<?php
namespace App\Http\Controllers\ticai ;
use App\Http\Controllers\Controller ;
use Illuminate\Http\Request;

class Base extends Controller
{
    public function index($slug){
        $slug = trim($slug) ;
        $slug = explode('/',$slug) ;
        $controller = $action = 'index' ;
        if(isset($slug[0]) && !empty($slug[0])){
            $controller = $slug[0] ;
        }
        if(isset($slug[1]) && !empty($slug[1])){
            $action = $slug[1] ;
        }

        $controller = $controller . 'Controller' ;
        $action = 'action'.ucfirst($action) ;
        $className = '\App\Http\Controllers\ticai\\'.ucfirst($controller) ;
        $class = new $className ;
        $response = call_user_func([$class , $action ]) ;
        return $response ;
    }

}